/*
 * MessagesGetListByMember.java
 *
 * Created on November 15, 2008, 8:27 AM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package jollylengkono.skripsi.Messages.action;

import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import jollylengkono.skripsi.dao.MessagesDao;
import jollylengkono.skripsi.model.Members;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

/**
 *
 * @author JollkY
 */
public class MessagesGetListByMember {
    
    /**
     * Creates a new instance of MessagesGetListByMember
     */
    public MessagesGetListByMember() {
    }
    
    public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response) {
        HttpSession sess = request.getSession(true);
        Members member = (Members) sess.getAttribute("memberSessObject");
        List messages = new ArrayList();
        messages = new MessagesDao().getListByMember(member.getId());
        request.setAttribute("messages", messages);
        return mapping.findForward("success");
    }
}
